#pragma once
#include "TesInclude.h"
#include "TesLexLocation.h"


enum TesTokenType
{
	TTT_OpSemicolon,
	TTT_Identifier,
	TTT_Decimal,
	TTT_Double,
	TTT_Scientific,
	TTT_Octal,
	TTT_Hexadecimal,
	TTT_String,
	TTT_EndOfStream,

	TTT_OpenParenthese,				// (
	TTT_CloseParenthese,			// )
	TTT_OpenBracket,				// [
	TTT_CloseBracket,				// ]
	TTT_OpenBrace,					// {
	TTT_CloseBrace,					// }

	TTT_OpAdd,						// +
	TTT_OpMinus,					// -
	TTT_OpMultiply,					// *
	TTT_OpDivide,					// /
	TTT_OpPower,					// ^
	TTT_OpMod,						// %
	TTT_OpObjectMemberAccess,		// :
	TTT_OpComma,					// ,
	TTT_OpTableMemberAccess,		// .
	TTT_OpStringConcatenate,		// ..
	TTT_OpVariousParameters,		// ...
	TTT_OpLessThan,					// <
	TTT_OpLessThanOrEqual,			// <=
	TTT_OpGreaterThan,				// >
	TTT_OpGreaterThanOrEqual,		// >=
	TTT_OpAssign,					// =
	TTT_OpEqual,					// ==
	TTT_OpUnequal,					// !=

	TTT_Do,
	TTT_End,
	TTT_While,
	TTT_If,
	TTT_Then,
	TTT_Elseif,
	TTT_Else,
	TTT_For,
	TTT_In,
	TTT_Function,
	TTT_Return,
	TTT_Break,
	TTT_Continue,
	TTT_Null,
	TTT_True,
	TTT_False,
	TTT_And,
	TTT_Or,
	TTT_Not,
	TTT_Class,
	TTT_Method,
	TTT_Struct,
	TTT_Enum,
	TTT_New,
	
	TTT_MAXCOUNT,
	TTT_InvalidType
};


struct TES_EXPORT TesToken
{
	TesToken()
		: Type( TTT_InvalidType )
		, Text( t("") )
		, Location( 0, 0 )
	{
	}

	TesToken( const TesToken & token )
		: Location( token.Location )
		, Type( token.Type )
		, Text( token.Text )
	{
	}

	TesToken( TesTokenType type, const TesLexLocation & location, const tstring & text = t("") )
		: Type( type )
		, Text( text )
		, Location( location )
	{
	}

	TesToken & operator=( const TesToken & rhs )
	{
		this->Location = rhs.Location;
		this->Type = rhs.Type;
		this->Text = rhs.Text;
		return *this;
	}

	TesLexLocation Location;
	TesTokenType Type;
	tstring Text;
};